(function($) {
	$.extend({
		my:{
			parseJsonResult:function(json,succFun,errFun){
				if(json){
					var status = json.status;
					if(!status){
						return ;
					}
					if(status == "200"){
						if(succFun){
							succFun(json);
							return ;
						}
					}else if(status == "601"){
						this.warning("会话超时，请重新登录",function(){
							//doLoginFun();
						});
						return ;
					}else{
						if(errFun){
							errFun((json.error?json.error:_getErrorMsg(status)),json);
							return ;
						}
						
					}
				}
			},
			parseTextResult:function(text,succFun,errFun){
				if(text){
					var data = $.trim(text);
					if(data.indexOf("{") == 0){
						eval("var json="+data);
						$.my.parseJsonResult(json,succFun,errFun);
					}else{
						if(succFun){
							succFun(text);
							return ;
						}
					}
				}
			}
			,
			alert:function(title, msg, icon, fn){
				//$.messager.alert(title, msg, icon, fn);
//				alert(msg);
				$.simpleAlert({
					title:title,
					content:msg,
					ok:fn,
					icon:icon
				});
			},
			confirm:function(title, msg, fn,icon){
				//$.messager.confirm(title, msg, fn);
				if(!icon && icon != 0){
					icon = 1;
				}
				$.simpleConfirm({
					title:title,
					content:msg,
					ok:fn,
					icon:icon
				});
			},
			info:function(msg, fn){
				this.alert("提示信息", msg,1, fn);
			},
			error:function(msg, fn){
				this.alert("错误信息", msg,1, fn);
			},
			warning:function(msg, fn){
				this.alert("警告信息", msg,1, fn);
			}
		}
	});
	function _getErrorMsg(status){
		var errMsg="";
		if(status == "400"){
			errMsg = "错误请求";	
		}else if(status == "401"){
			errMsg = "请求未被授权";	
		}else if(status == "403"){
			errMsg = "请求被拒绝";	
		}else if(status == "404"){
			errMsg = "请求页面未找到";	
		}else if(status == "405"){
			errMsg = "请求method不被允许";	
		}else if(status == "500"){
			errMsg = "系统错误";	
		}else if(status == "600"){
			errMsg = "参数传递不合法";	
		}else if(status == "601"){
			errMsg = "登录信息失效";	
		}
		return errMsg;
	}
})(jQuery);
var isJson = function(obj){ 
    var isjson = typeof(obj) == "object" && Object.prototype.toString.call(obj).toLowerCase() == "[object object]" && !obj.length; 
    return isjson; 
}
